package guava;

import com.google.common.base.Preconditions;

/**
 * @author Daniel
 */
public class PreconditionsTest {

    public static void main(String[] args) {

        try {
            checkName(null);
        } catch (Exception e) {
            e.printStackTrace();
        }

        System.out.println(" ============================================= ");

        try {
            checkAge(17);
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

    public static void checkName(String name) {
        Preconditions.checkNotNull(name, "name must be given!");
    }

    public static void checkAge(int age) {
        Preconditions.checkArgument(age >= 18, "thie game you can not play it, your age is under 18!");
    }

}
